home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / newsgroups / misc.19980424-19980901 / 000234_news@newsmaster….columbia.edu _Fri Jun 26 11:10:01 1998.msg < prev    next >
Internet Message Format  |  1998-08-31  |  4KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id LAA27815
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 26 Jun 1998 11:10:00 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id LAA00696
  7.     for kermit.misc@watsun; Fri, 26 Jun 1998 11:10:00 -0400 (EDT)
  8. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: Get port of previous failed set line command
  12. Date: 26 Jun 1998 15:09:56 GMT
  13. Organization: Columbia University
  14. Lines: 76
  15. Message-ID: <6n0dk4$ri8$1@apakabar.cc.columbia.edu>
  16. References: <3593B304.716C@yahoo.com>
  17. NNTP-Posting-Host: watsun.cc.columbia.edu
  18. Xref: news.columbia.edu comp.protocols.kermit.misc:8925
  19.  
  20. In article <3593B304.716C@yahoo.com>, Art L. <art1958@yahoo.com> wrote:
  21. : I have a kermit script which then "takes" from a file called kermit.dat.
  22. : kermit.dat contains "set line /dev/tty1A" (or what ever the local modem
  23. : port may be).  If the modem is not available the parent script is aware
  24. : of this because \v(line) equals /dev/tty.  
  25. Or because the SET LINE command failed.
  26.  
  27. : What I would like to do is add some code to the parent script to keep
  28. : attempting to set line /dev/ttysomething every 10 seconds until it is
  29. : available.  However the parent script does not know what the 
  30. : ttysomething should be. There does not seem to be a built in variable 
  31. : which contains this information.
  32. So define your own variable.  The top script can:
  33.  
  34.   define deviceiwant /dev/tty1A
  35.  
  36. and the bottom script can refer to it as:
  37.  
  38.   \m(deviceiwant)
  39.  
  40. : Currently I have my take kermit.dat command in a loop from which I 
  41. : break out of if \v(line) is something other than /dev/tty.
  42. :
  43. Well, I'm not sure why you have two script files, but the normal way to
  44. do this kind of thing is:
  45.  
  46.   define deviceiwant /dev/tty1A  ; Device
  47.   define \%t 100                 ; Number of tries
  48.  
  49.   for \%i 1 \%t 1 {              ; Loop to try \%t times to open the device
  50.       set line \m(deviceiwant)
  51.       if success break
  52.       pause 10
  53.   }
  54.   if > \%i \%t stop 1 Failed to open \m(deviceiwant) after \%t tries.
  55.  
  56. A refinement on this allows you to cycle through a list of dialout devices
  57. until you get one (the one-line array initialization requires C-Kermit 6.1):
  58.  
  59.   define \%n 5                   ; Number of lines
  60.   define \%t 100                 ; Number of tries per line
  61.   declare \&a[\%n] = /dev/cua0 /dev/cua1 /dev/ttyS3 /dev/ttyS4 /dev/modem5
  62.  
  63.   for \%i 1 \%t 1 {              ; Loop for \%t tries
  64.       for \%j 1 \%n 1 {          ; Loop for each device
  65.           set line \&a[\%j]
  66.           if success goto gotit
  67.       }
  68.       pause 10                   ; Pause probably not needed here
  69.   }
  70.   if > \%1 \%t stop 1 Failed to get a line
  71. :gotit
  72.   ...
  73.  
  74. A further refinement would read the available devices from the UUCP
  75. Devices file, but that's problematic because (a) this file is normally
  76. read-protected, and (b) its format is likely to vary from one UNIX version
  77. to another.
  78.  
  79. : What I
  80. : really want to do is to read the lock file (ie /usr/spool/uucp/LCK..1a)
  81. : to get the process ID (and therefore the program and user) of the
  82. : locking process.
  83. That will not be possible if the lock file is read-protected.  Also note that
  84. the name and location of the lockfile, as well as the format of the PID, will
  85. vary from one UNIX version to another.
  86.  
  87. When C-Kermit determines that a device is locked, it displays the pid from
  88. the lockfile (using built-in knowledge about the location, name, and format
  89. of the lockfile), but this information is currently not available
  90. programmatically.  I'll add this to the list for C-Kermit 6.1.
  91.  
  92. - Frank